<?php
$recent = date("U")-900;
$getusersonline = "SELECT userID,username,status from b_users where lasttime>'$recent'";
$getusersonline2 = mysql_query($getusersonline, $forum) or die("Error #1: " . mysql_error());
$num = mysql_num_rows($getusersonline2);
$countguests = "SELECT DISTINCT guestip from guestsonline where time > '$recent'";
$countguests2 = mysql_query($countguests, $forum) or die("Error #2: " . mysql_error());
$thecount = mysql_num_rows($countguests2);

print "<table class='maintable' cellspacing='0'>";
print "<tr><td colspan='2' class='headline'><b>Who is online</td></tr>";
print "<tr><td colspan='2' class='catline'><b>There have been $num members and $thecount guests online in the last 15 minutes</td></tr>";
print "<tr><td class='forumrow' style='font-family:Arial, Helvetica, sans-serif'>";
while($getusersonline3 = mysql_fetch_array($getusersonline2))
{
	if ($getusersonline3['status'] >= 3)
	{
		print "<a href='profile.php?userID=$getusersonline3[userID]' style='color:orange'><strong>$getusersonline3[username]</strong></a>, ";
	}
	else if ($getusersonline3[status]=='2')
	{
		print "<a href='profile.php?userID=$getusersonline3[userID]' style='color:#0099FF'>$getusersonline3[username]</a>, ";
	}
	else if ($getusersonline3[status]=='1')
	{
		print "<a href='profile.php?userID=$getusersonline3[userID]' style='color:lime'>$getusersonline3[username]</a>, ";
	}
		else {print "<A href='profile.php?userID=$getusersonline3[userID]'>$getusersonline3[username]</a>, ";
	}
}
print "<br><span style='color:orange'><strong>Admin</strong></span> - <span style='color:#0099FF'>Supermoderator</span> - <span style='color:lime'>Game Master</span> - <span style='color:white'>Player</span></td></tr></table><table width='100%' border='0' cellspacing='0' cellpadding='0' ><tr><td class='endingleft' width='16px'>&nbsp;</td><td class='ending'>&nbsp;</td><td class='endingright' width='16px'>&nbsp;</td></tr></table><br>";
?>